package com.hue.concurrent.day06;

/**
 * volatile保证可见性的案例
 */
public class Demo01 {
    public static  boolean flag = true;

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            while (flag) {
//                System.out.println(flag);
            }
        }).start();

        Thread.sleep(1000);

        flag = false;
    }
}
